<?php

namespace common\models;

use Yii;

/**
 * This is the model class for table "{{%exhibition_comments}}".
 *
 * @property integer $id
 * @property integer $exhibition_id
 * @property integer $user_id
 * @property integer $overview
 * @property integer $service
 * @property integer $effect
 * @property integer $popularity
 * @property string $content
 * @property integer $good_number
 * @property integer $reply_number
 * @property integer $status
 * @property integer $version
 * @property string $created_by
 * @property integer $created_at
 * @property string $created_from
 * @property string $created_ip
 * @property string $updated_by
 * @property integer $updated_at
 * @property string $updated_from
 * @property string $updated_ip
 * @property integer $is_deleted
 *
 * @property Exhibition $exhibition
 */
class ExhibitionComments extends \common\base\BaseActiveRecord
{
    /**
     * @inheritdoc
     */
    public static function tableName()
    {
        return '{{%exhibition_comments}}';
    }

    /**
     * @inheritdoc
     */
    public function rules()
    {
        return [
            [['exhibition_id', 'user_id'], 'required'],
            [['exhibition_id', 'user_id', 'overview', 'service', 'effect', 'popularity', 'good_number', 'reply_number', 'status', 'version', 'created_at', 'updated_at', 'is_deleted'], 'integer'],
            [['content'], 'string', 'max' => 255],
            [['created_by', 'created_from', 'created_ip', 'updated_by', 'updated_from', 'updated_ip'], 'string', 'max' => 50],
            [['exhibition_id'], 'exist', 'skipOnError' => true, 'targetClass' => Exhibition::className(), 'targetAttribute' => ['exhibition_id' => 'id']],
        ];
    }

    /**
     * @inheritdoc
     */
    public function attributeLabels()
    {
        return [
            'id' => Yii::t('common', 'id'),
            'exhibition_id' => Yii::t('common', 'exhibition_id'),
            'user_id' => Yii::t('common', 'user_id'),
            'overview' => Yii::t('common', 'overview'),
            'service' => Yii::t('common', 'service'),
            'effect' => Yii::t('common', 'effect'),
            'popularity' => Yii::t('common', 'popularity'),
            'content' => Yii::t('common', 'content'),
            'good_number' => Yii::t('common', 'good_number'),
            'reply_number' => Yii::t('common', 'reply_number'),
            'status' => Yii::t('common', 'status'),
            'version' => Yii::t('common', 'version'),
            'created_by' => Yii::t('common', 'created_by'),
            'created_at' => Yii::t('common', 'created_at'),
            'created_from' => Yii::t('common', 'created_from'),
            'created_ip' => Yii::t('common', 'created_ip'),
            'updated_by' => Yii::t('common', 'updated_by'),
            'updated_at' => Yii::t('common', 'updated_at'),
            'updated_from' => Yii::t('common', 'updated_from'),
            'updated_ip' => Yii::t('common', 'updated_ip'),
            'is_deleted' => Yii::t('common', 'is_deleted'),
        ];
    }

    /**
     * @return \yii\db\ActiveQuery
     */
    public function getExhibition()
    {
        return $this->hasOne(Exhibition::className(), ['id' => 'exhibition_id']);
    }
}
